﻿/*  
 * Helix Engine
 * http://helixengine.codeplex.com/
 * 
 * Copyright (c) 2010 - 2011 Joe Hegarty
 *  
 * This source code is subject to the terms of the Microsoft Public License (Ms-PL). 
 *  
 * Redistribution and use in source and binary forms, with or without modification, 
 * is permitted provided that redistributions of the source code retain the above 
 * copyright notices and this file header. 
 * 
 * For details please see http://www.opensource.org/licenses/ms-pl.html 
 *  
 * All other rights reserved. 
 *
 */  


using System;

using HelixEngine.Maths;

namespace HelixGame.World.Entities.Components
{
    /// <remarks>
    /// An abstract representation of an entity component
    /// </remarks>
    public abstract class EntityComponent
    {
        Entity _entity = null;

        /// <summary>
        /// Initialises the component
        /// </summary>
        /// <param name="entity">The parent entity</param>
        public void Initialise(Entity entity)
        {
            _entity = entity;

            OnInitialised();
        }

        /// <summary>
        /// 
        /// </summary>
        public void Cleanup()
        {
            OnCleanup();
        }

        /// <summary>
        /// 
        /// </summary>
        protected Entity Parent
        {
            get { return _entity; }
        }

        /// <summary>
        /// 
        /// </summary>
        public virtual void OnInitialised()
        {
        
        }

        /// <summary>
        /// 
        /// </summary>
        public virtual void OnCleanup()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="time"></param>
        public virtual void Update(EngineTime time)
        {

        }
    }
}
